Flash MX Professional 2004 Data Integration Using Microsoft Active Server Pages (ASP)
Table of Contents
Using Other Middleware and Databases
Connecting to another database can be accomplished simply by changing the connection string after the cnn.open command. You could use another direct driver like the Microsoft Jet driver you are using in this example, or you could use a standard ODBC connection string and connect to any ODBC source you have defined on your server.
To find a connection string for your database, simply Google "database connection strings," and you will be rewarded with hundreds of samples.
To get this ASP logic to work correctly, however, you must set the two constants correctly at the top of the ASP file. These constants define your database's capabilities so the script can adjust appropriately.
| Constant | Type | Purpose |
|---|---|---|
| DBRETURNSERROR | Boolean | Lets the script know if the database returns an error on an Update when the key field is not found |
| DBRETURNSIDENTITY | Boolean | Indicates whether the database returns the new identity or autonumber key value after an insert |
If you lay your offerings at the feet of other middleware like Macromedia ColdFusion, ASP.NET, or PERL, do not fear. The general principles used in this example are applicable to any other middleware. As long as it can receive a POST XML document, iterate through it, connect to the database, and return an XML document, it will work. All of the above-mentioned middleware, and most others, will work just fine. Depending on the middleware you choose, you may have to use the WebServicesConnector component instead of the XMLConnector component in Flash, but you can produce the same results. Check this out in Ben Forta's article, Employee Updater: Building a Client-Server Application with Macromedia Flash Data Connection Wizard and ColdFusion.